for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import fs from 'fs-extra';
import { DEFAULT_JSON_OFFSET } from '../constants';
import Base from './Base';
export default class JSONReporter extends Base {
_generate(groups, map) {
const injected = Object.keys(groups)
.map(groupName => ({
group : groupName,
titles : Object.keys(groups[groupName])
.map(title => ({
name : title,
actions : groups[groupName][title]
.map(id => map.get(id))
.map(action => ({
request : action.request,
response : action.response
}))
}));
return JSON.stringify(injected, null, DEFAULT_JSON_OFFSET);
}
async write(actions) {
const { groups, map } = this._build(actions);
const content = this._generate(groups, map);
await fs.writeFile(this.file, content);